﻿using System;

namespace b3.埃式筛法
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int[] arr = new int[101];   //初始值为0
            int i, j;
            for (i = 2; i <= 100; i++)
            {
                if (arr[i] == 0)
                    for (j = 2 * i; j <= 100; j += i)
                        arr[j] = 1;
            }

            Console.WriteLine("2～100内的素数有：");
            for (i = 2; i <= 100; i++)
                if (arr[i] == 0)
                    Console.Write(i + " ");
            Console.WriteLine();
            Console.ReadLine();
        }
    }
}
